﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Web.Mvc;
using System.Web.Security;

namespace File_Manager.Models
{

    public class ParentModelViewRegistro
    {
        public RegisterModel RegisterModel { get; set; }
        public User_I User_I { get; set; }

        public ParentModelViewRegistro()
        {
            this.RegisterModel = new RegisterModel();
            this.User_I = new User_I();
        }
    }

    public class ParentModelViewUser
    {
        public UserModel UserModel { get; set; }
        public User_I User_I { get; set; }

        public ParentModelViewUser()
        {
            this.UserModel = new UserModel();
            this.User_I = new User_I();
        }
    }


    public class ChangePasswordModel
    {
        [Required(ErrorMessage = "La contraseña actual es requerida")]
        [DataType(DataType.Password)]
        [Display(Name = "Contraseña Actual")]
        public string OldPassword { get; set; }

        [Required(ErrorMessage = "La contraseña nueva es requerida")]
        [StringLength(100, ErrorMessage = "La contraseña debe ser al menos de {2} caracteres de longitud.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Nueva Contraseña")]
        public string NewPassword { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirmar Nueva Contraseña")]
        [Compare("NewPassword", ErrorMessage = "La contraseña nueva y la de confirmación no coinciden")]
        public string ConfirmPassword { get; set; }
    }

    public class LogOnModel
    {
        [Required(ErrorMessage = "El nombre de usuario es requerido")]
        [Display(Name = "Nombre Usuario  Ej.19145892")]
        [RegularExpression(@"^[0-9]*$", ErrorMessage = "La cédula debe ser Númerica.")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "La contraseña es requerida")]
        [DataType(DataType.Password)]
        [Display(Name = "Controseña")]
        public string Password { get; set; }

        [Display(Name = "Recordarme?")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {
        [Required(ErrorMessage = "El Número de Cédula es requerido")]
        [Display(Name = "Número de Cédula Ej.19145892")]
        [RegularExpression(@"^[0-9]*$", ErrorMessage = "La cédula debe ser Númerica.")]
        [StringLength(8, ErrorMessage = "La cédula debe ser de 7 o 8 de largo .", MinimumLength = 7)]
        public string UserName { get; set; }

        [Required(ErrorMessage = "El correo es requerido")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Correo Electrónico")]
        [RegularExpression(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$", ErrorMessage = "No es un email válido.")]
        public string Email { get; set; }

        [Required(ErrorMessage = "El correo de Confirmación es requerido")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = " Confirmación Correo Electrónico")]
        [RegularExpression(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$", ErrorMessage = "No es un email válido.")]
        //[Compare("Email", ErrorMessage = "El Correo Electrónico y el de confirmación no coinciden.")]
        public string c_Email { get; set; }

        [Required(ErrorMessage = "La contraseña es requerida")]
        [StringLength(100, ErrorMessage = "La contraseña debe ser al menos de {2} de longitud.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Contraseña")]
        public string Password { get; set; }

        [Required(ErrorMessage = "La contraseña de Confirmación es requerida")]
        [DataType(DataType.Password)]
        [Display(Name = "Confirmar Contraseña")]
        //[Compare("Password", ErrorMessage = "La contraseña y la de confirmación no coinciden.")]
        public string ConfirmPassword { get; set; }

    }

    //***********************************************************************************//
    // Autor:  			Adrian Di Puglia	                		     				*//
    //***********************************************************************************//
    // UserModel: Empleado para Details y Edit USER             			        	*//
    // _________________________________________________________________________________*//

    public class UserModel
    {
        [Display(Name = "Número de Cédula (Usuario)")]
        [RegularExpression(@"^[0-9]*$", ErrorMessage = "La cédula debe ser Númerica.")]
        [StringLength(8, ErrorMessage = "La cédula debe ser de 7 o 8 de largo .", MinimumLength = 7)]
        public string UserName { get; set; }

        [Required(ErrorMessage = "El correo es requerido")]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "Correo Electrónico")]
        [RegularExpression(@"^(([\w-]+\.)+[\w-]+|([a-zA-Z]{1}|[\w-]{2,}))@((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\.([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|([a-zA-Z]+[\w-]+\.)+[a-zA-Z]{2,4})$", ErrorMessage = "No es un email válido.")]
        public string Email { get; set; }

        [Display(Name = "Fecha Creación")]
        [DataType(DataType.Date)]
        public DateTime? CreationDate { get; set; }

        [Display(Name = "Fecha Sesión")]
        [DataType(DataType.Date)]
        public DateTime? LastLoginDate { get; set; }

        [Display(Name = "Status")]
        public bool IsApproved { get; set; }
    }

    //***********************************************************************************//
    // Autor:  			Adrian Di Puglia	                		     				*//
    //***********************************************************************************//
    // getPassword: Recuperar Password                           			        	*//
    // _________________________________________________________________________________*//

    public class getPassword
    {
        [Required(ErrorMessage = "El nombre de usuario es requerido")]
        [Display(Name = "Nombre Usuario  Ej.19145892")]
        [RegularExpression(@"^[0-9]*$", ErrorMessage = "La Nombre Usuario debe ser Númerico.")]
        public string UserName { get; set; }

        [DataType(DataType.EmailAddress)]
        [Display(Name = "Correo Electrónico")]
        public string Email { get; set; }
    }

}
